﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<QLPKWeb.Models.FormBean.LichLamViecModel.LichLamViecForm>" %>

<%@ Import Namespace="QLPKWeb.Models.LinQ.LichLamViec" %>
<%@ Import Namespace="QLPKWeb.Models.FormBean.LichLamViecModel" %>
<%@ Import Namespace="Webdiyer.WebControls.Mvc" %>
<%@ Import Namespace="System.Web.Mvc.Html" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <script type="text/javascript" language="javascript" src="<%= ResolveUrl("~/Content/Scripts/LichLamViec/DuyetLich.js") %>"></script>
    <script type="text/javascript" language="javascript" src="<%= ResolveUrl("~/Content/Scripts/KiemTra.js") %>"></script>
    <script language="javascript" type="text/javascript">
        $(document).ready(function () {
            selectMenu("LichLamViec-DuyetLich");
            $("#LichLamViec-DuyetLich").parent().attr("class", "opened");
        });
        $(document).ready(function () {
            $("#ToDate").datepicker({ dateFormat: 'dd/mm/yy' });
            $("#FromDate").datepicker({ dateFormat: 'dd/mm/yy' });
        }); 
    </script>

    <form id="form" method="post" action="#">
        <input type="hidden" id="inListIdChuaDuyet" name="inListIdChuaDuyet" value="<%=Model.inListIdChuaDuyet %>"/>
        <input type="hidden" id="inListIdDuyet" name="inListIdDuyet" value="<%=Model.inListIdDuyet %>"/>
        <input type="hidden" id="ID" name="ID" value="<%=Model.ID %>"/>
        <%=Html.Hidden("PageNumber", Model.PageNumber)%>
        <div class="box round first fullpage">
            <h4> Danh sách đăng ký lịch làm việc</h4>
            <div style="text-align:center; padding-top: 15px;" >  
            <span style="display:inline;">Chọn ngày</span>
                        <% int dayofweek = (int)DateTime.Now.DayOfWeek; %>
                        <input name="FromDate" id="FromDate" 
                            value="<%= !string.IsNullOrEmpty(Model.FromDate) ? Model.FromDate : DateTime.Now.AddDays(-dayofweek + 1).ToString("dd/MM/yyyy") %>" 
                            style="display: inline;" />
                        <span style="display:inline; margin-left: 40px;">Đến ngày</span>
                        <input name="ToDate" id="ToDate" 
                            value="<%= !string.IsNullOrEmpty(Model.ToDate) ? Model.ToDate : DateTime.Now.AddDays(7 - dayofweek).ToString("dd/MM/yyyy") %>" 
                            style="display: inline;" />
                        <input type="button" value="Xem" onclick="javascript:DoView()" style="display: inline;" />                       
                        <input type="button" value="Ghi nhận" onclick="javascript:DoGhiNhan()" style="display: inline;" />
            </div>
           
            <table style="width: 100%; font-size: 12px;">
                <tr>
                    <td colspan="4">
                        <%--Thông Báo--%>
                        <div id="MessageLichLamViec" style="font-size: 12px; color: Blue; font-weight: bold">
                            <%=Model.MessageCreateLichLamViec %>
                            <%=Model.MessageEditLichLamViec %>
                        </div>
                        <%--end--%>
                    </td>
                </tr>
              
                <tr >
                    <td colspan="4">
                          <div class="box round first grid" style="border: 1px solid #ddd ; width: 1100px;overflow: auto">
                      <h5 style="font-weight: bold">Lịch Chờ Duyệt</h5>
                        <table cellspacing="0" cellpadding="0"style="width: 100%" id="tblChuaDuyet" >
                            <tr class="title" id="0">
                                <td style="border: 1px solid #ddd "class="first" align="left">
                                    <input type="checkbox" id="CheckAllChuaDuyet" name="CheckAllChuaDuyet" style="display:inline;" 
                                       onclick="javascript:DoDuyetAllChuaDuyet();" />
                                </td>
                                <td style="border: 1px solid #ddd "nowrap="nowrap">
                                    <strong>Người đăng ký</strong>
                                </td>
                                <td style="border: 1px solid #ddd "nowrap="nowrap" width="150px">
                                    <strong>
                                        Nội dung
                                    </strong>
                                </td>
                                <td style="border: 1px solid #ddd "nowrap="nowrap" width="150px">
                                    <strong>
                                        Thành phần
                                    </strong>
                                </td>
                                <td style="padding-left: 8px; padding-right: 8px;border: 1px solid #ddd " nowrap="nowrap" align="center">
                                    <strong>
                                        Thời gian bắt đầu
                                    </strong>
                                </td>
                                <td style="padding-left: 8px; padding-right: 8px;border: 1px solid #ddd " nowrap="nowrap;" align="center">
                                    <strong>
                                        Thời gian kết thúc
                                    </strong>
                                </td>
                                <td style="border: 1px solid #ddd " nowrap="nowrap">
                                    <strong>
                                        Người chuẩn bị
                                    </strong>
                                </td>
                                <td style="border: 1px solid #ddd "class="last" nowrap="nowrap" width="25px">
                                    <strong>
                                    
                                    </strong>
                                </td>
                            </tr>
                        <% foreach (LichLamViec item in Model.ListLichChuaDuyet)
                           {
                            %>
                            <tr class="item_row" onclick="javascript:highlight(this);" id="<%= item.ID %>">
                                <td style="border: 1px solid #ddd "class="first" align="left">
                                    <input type="checkbox" id="chkCheckChuaDuyet<%= item.ID%>" name="chkCheckChuaDuyet" value="<%= item.ID %>" onclick="CheckSingles('CheckAllChuaDuyet', 'chkCheckChuaDuyet', 'form')"/>
                                    <%--onclick="javascript:DoDuyetChuaDuyet(<%= item.ID %>);"--%>
                                </td>
                                <td style="border: 1px solid #ddd "nowrap="nowrap">
                                    <%= Model.GetDisplayNameOfuserById(item.NguoiTao != null ? item.NguoiTao.Value : 0)%>
                                </td>
                                <td style="border: 1px solid #ddd ">
                                    <a style="color: blue" title="<%=item.NoiDung %>"><%= DONGACS.Common.ConvertUtils.TruncateAtWord(item.NoiDung,30) %></a>
                                </td>
                                <td style="border: 1px solid #ddd "nowrap="nowrap">
                                    <%= Model.GetDisplayNameOfThanhPhan(item.LichLamViecShareds.ToList()) %>
                                </td>
                                <td style="border: 1px solid #ddd "align="center">
                                    <%= item.StartTime != null ? "<b>" + item.StartTime.Value.ToString("dd/MM/yyyy") + "</b>" + "<br/>Lúc " + item.StartTime.Value.ToString("HH") + " Giờ " + item.StartTime.Value.ToString("hh") + " phút" : ""%>
                                </td>
                                <td style="border: 1px solid #ddd "align="center">
                                    <%= item.EndTime != null ? "<b>" + item.EndTime.Value.ToString("dd/MM/yyyy") + "</b>" + "<br/>Lúc " + item.EndTime.Value.ToString("HH") + " Giờ " + item.EndTime.Value.ToString("hh") + " phút" : ""%>
                                </td>
                                <%--<td align="center">
                                    <%= item.EventDate != null ? item.EventDate.Value.ToString("dd/MM/yyyy") : ""%>
                                </td>--%>
                                <td nowrap="nowrap"style="border: 1px solid #ddd ">
                                    <%--<%= item.NguoiChuanBi != null ? Model.GetDisplayNameOfuserById(item.NguoiChuanBi.Value) : "" %>--%>
                                    <%= Model.GetDisplayNameOfNguoiChuanBi(item.LichLamViec_NguoiChuanBis.ToList()) %>
                                </td>
                                <td style="border: 1px solid #ddd ">
                                    <a onclick="javascript:window.location.href = basePath + 'LichLamViec/SuaLichLamViec/<%= item.ID %>';">Sửa</a>
                                </td>
                            </tr>
                            <%
                           } %>
                            <tr class="border_bottom" id="border_bottom_ChuaDuyet">
                                <td class="first" style="background: #DDDDDD">
                                </td>
                                <td class="last" colspan="9" align="right" style="background: #DDDDDD; padding-right: 10px">                                     
                                     <%--<%
                                     PagerOptions pagerOptions = new PagerOptions();
                                     pagerOptions.PageIndexParameterName = "id";
                                     %>
                                    <div><%=Html.Pager(Model.LichLamViecPagedList,pagerOptions) %></div>
                                    <%=Html.Hidden("PageNumber", Model.PageNumber)%>--%>
                                </td>
                            </tr>
                        </table>
                        </div>
                    </td>
                </tr>
            
                <tr>
                    <td colspan="11">
                      <%--Chọn ngày Xem lịch, Ghi nhận--%>
                    </td>
                </tr>
                <tr>
                    <td align="center">
                         <img src="../../Content/img/Arrows-Down-icon.png" title="Duyệt" onclick="javascript:DoChkChuaDuyet()"/>
                        <img src="../../Content/img/Arrows-Up-icon.png" title="Bỏ Duyệt" onclick="javascript:DoChkDaDuyet()"  />
                    </td>
                </tr>
              
                <tr>
                    <td colspan="4">
                      <div class="box round first grid" style="border: 1px solid #ddd; width: 1100px;overflow: auto" >
                          <h5 style="font-weight: bold">Lịch Chờ Duyệt</h5>
                        <table cellspacing="0" cellpadding="0" style="width: 100% "  id="tblDaDuyet">
                            <tr class="title" id="Tr1">
                                <td style="border: 1px solid #ddd "class="first" align="left">
                                    <input type="checkbox" id="CheckAllDaDuyet" name="CheckAllDaDuyet" style="display:inline;" 
                                    onclick="javascript:DoDuyetAllDaDuyet();" />
                                </td>
                                <td style="border: 1px solid #ddd "nowrap="nowrap">
                                    <strong>Người đăng ký</strong>
                                </td>
                                <td style="border: 1px solid #ddd "nowrap="nowrap" width="150px">
                                    <strong>
                                        Nội dung
                                    </strong>
                                </td>
                                <td style="border: 1px solid #ddd "nowrap="nowrap" width="150px">
                                    <strong>
                                        Thành phần
                                    </strong>
                                </td>
                                <td style="padding-left: 8px;border: 1px solid #ddd; padding-right: 8px;" nowrap="nowrap" align="center">
                                    <strong>
                                        Thời gian bắt đầu
                                    </strong>
                                </td>
                                <td style="padding-left: 8px; border: 1px solid #ddd;padding-right: 8px;" nowrap="nowrap" align="center">
                                    <strong>
                                        Thời gian kết thúc
                                    </strong>
                                </td>
                                <td style="border: 1px solid #ddd "nowrap="nowrap">
                                    <strong>
                                        Người chuẩn bị
                                    </strong>
                                </td>
                                <td style="border: 1px solid #ddd "class="last" nowrap="nowrap" width="25px">
                                    <strong>
                                    
                                    </strong>
                                </td>
                            </tr>
                           
                        <% foreach (LichLamViec item in Model.ListLichDaDuyet)
                           {
                            %>
                            <tr class="item_row" onclick="javascript:highlight(this);" id="<%= item.ID %>">
                                <td style="border: 1px solid #ddd "class="first" align="left">
                                    <input type="checkbox" id="chkCheckDaDuyet<%= item.ID%>" name="chkCheckDaDuyet" value="<%= item.ID %>" onclick="CheckSingles('CheckAllDaDuyet', 'chkCheckDaDuyet', 'form')"/>
                                    <%--onclick="javascript:DoDuyetDaDuyet(<%= item.ID %>);"--%>
                                </td>
                                <td style="border: 1px solid #ddd "nowrap="nowrap">
                                    <%= Model.GetDisplayNameOfuserById(item.NguoiTao != null ? item.NguoiTao.Value : 0)%>
                                </td>
                                <td style="border: 1px solid #ddd ">
                                    <a style="color: blue"title="<%= item.NoiDung %>"><%= DONGACS.Common.ConvertUtils.TruncateAtWord(item.NoiDung,30) %></a>
                                </td>
                                <td style="border: 1px solid #ddd "nowrap="nowrap">
                                    <%= Model.GetDisplayNameOfThanhPhan(item.LichLamViecShareds.ToList()) %>
                                </td>
                                  <td style="border: 1px solid #ddd "align="center">
                                    <%= item.StartTime != null ? "<b>" + item.StartTime.Value.ToString("dd/MM/yyyy") + "</b>" + "<br/>Lúc " + item.StartTime.Value.ToString("hh") + " Giờ " + item.StartTime.Value.ToString("hh") + " phút" : ""%>
                                </td>
                                <td style="border: 1px solid #ddd "align="center">
                                    <%= item.EndTime != null ? "<b>" + item.EndTime.Value.ToString("dd/MM/yyyy") + "</b>" + "<br/>Lúc " + item.EndTime.Value.ToString("hh") + " Giờ " + item.EndTime.Value.ToString("hh") + " phút" : ""%>
                                </td>
                               <%-- <td align="center">
                                    <%= item.EventDate != null ? item.EventDate.Value.ToString("dd/MM/yyyy") : ""%>
                                </td>--%>
                                <td style="border: 1px solid #ddd "nowrap="nowrap">
                                    <%--<%= item.NguoiChuanBi != null ? Model.GetDisplayNameOfuserById(item.NguoiChuanBi.Value) : "" %>--%>
                                    <%= Model.GetDisplayNameOfNguoiChuanBi(item.LichLamViec_NguoiChuanBis.ToList()) %>
                                </td>
                                <td style="border: 1px solid #ddd "></td>
                                <%--<td>
                                    <a onclick="javascript:window.location.href = basePath + 'LichLamViec/SuaLichLamViec/<%= item.ID %>';">Sửa</a>
                                </td>--%>
                            </tr>
                            <%
                           } %>
                            <tr class="border_bottom" id="border_bottom_DaDuyet">
                                <td class="first" style="background: #DDDDDD">
                                </td>
                                <td class="last" colspan="9" align="right" style="background: #DDDDDD; padding-right: 10px">                                     
                                     <%--<%
                                     PagerOptions pagerOptions = new PagerOptions();
                                     pagerOptions.PageIndexParameterName = "id";
                                     %>
                                    <div><%=Html.Pager(Model.LichLamViecPagedList,pagerOptions) %></div>
                                    <%=Html.Hidden("PageNumber", Model.PageNumber)%>--%>
                                </td>
                            </tr>
                        </table>
                        </div>
              
                
                    </td>
                </tr>
            </table>
        </div>
    </form>

    <div style='width:250px; height:180px;display:none; z-index:100000;  position:absolute; border:5px solid #ddd; background:#fff; padding:4px' id="ViewNguoiChuanBi">
        <div style='width:100%; height:10px;'>
        <img src="<%=ResolveUrl("~/Content/ImagesAdmin/publish_x.png")%>" style='float:right; margin:3px; cursor:pointer;' title='close' 
            onclick='$("#ViewNguoiChuanBi").css("display", "none")'>
        </div>
        <div style='width:100%; height:90px; overflow:auto'>
            <div id="tbl_DanhSachNguoiChuanBi">
                <table>
                    <tbody>
                               
                    </tbody>
                </table>
            </div>
        </div>
        <div class="pagebreak"> &nbsp;</div>
        <div style="text-align:center"><input type="button" id="OK" name="OK" value="OK" onclick='$("#ViewNguoiChuanBi").css("display", "none")'/></div>
    </div>

    <div style='width:250px; height:180px;display:none; z-index:100000;  position:absolute; border:5px solid #ddd; background:#fff; padding:4px' id="ViewThanhPhan">
        <div style='width:100%; height:10px;'>
        <img src="<%=ResolveUrl("~/Content/ImagesAdmin/publish_x.png")%>" style='float:right; margin:3px; cursor:pointer;' title='close' 
            onclick='$("#ViewThanhPhan").css("display", "none")'>
        </div>
        <div style='width:100%; height:90px; overflow:auto'>
            <div id="tbl_DanhSachThanhPhan">
                <table>
                    <tbody>
                               
                    </tbody>
                </table>
            </div>
        </div>
        <div class="pagebreak"> &nbsp;</div>
        <div style="text-align:center"><input type="button" id="Button1" name="OK" value="OK" onclick='$("#ViewThanhPhan").css("display", "none")'/></div>
    </div>
</asp:Content>
